﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebSoftSeo.Models;
using WebSoftSeo.Utility;

namespace WebSoftSeo.Controllers
{
    public class ConsultController : Controller
    {
        private WebSoftSeoEntities db = new WebSoftSeoEntities();
        public ActionResult Index()
        {
            
            return View();
        }
        //
        // POST: /Comment/Create

          [HttpPost]
          public ActionResult FormCreate(Consult _consult)
          {
              if (ModelState.IsValid)
              {
                  _consult.Date = DateTime.Now;
                  _consult.Status = false;
                  _consult.IPuser = System.Web.HttpContext.Current.Request.UserHostAddress;
                  db.Consults.Add(_consult);
                  db.SaveChanges();
              }
              return RedirectToAction("index", "Home");
              
          }
          public ActionResult ContentConsult(int page = 0)
          {
              int skip = 0;
              if (page != 0)
              {
                  skip = 2 * (page - 1);

              }
              int count = db.Consults.Count();
              return PartialView();
          }
          protected override void Dispose(bool disposing)
          {
              if (disposing && (db != null))
              {
                  db.Dispose();
              }
              base.Dispose(disposing);
          }
    }
}
